HOWTO install "GO" and compile a "Hello World" program on Ubuntu Linux
"Here we GO !"
ubuntuprompt$ sudo apt-get install bison gcc libc6-dev ed
-------------------------------------------------------------------------------------------------------------------------------------
Edit .bashrc (I used vi and added four lines)
ubuntuprompt$ vi $HOME/.bashrc
export GOBIN=$HOME/go/bin
export PATH=$PATH:$GOBIN
export GOOS='linux' # Refers to the TARGET environment !
export GOARCH='386' # Refers to the TARGET environment !
(start a fresh Terminal session before proceeding)
ubuntuprompt$ env | grep '^GO'
GOBIN=/home/mike/go/bin
GOARCH=386
GOROOT=/home/mike/go
GOOS=linux -------------------------------------------------------------------------------------------------------------------------------------
ubuntuprompt$ sudo apt-get install mercurial
ubuntuprompt$ hg clone -r release https://go.googlecode.com/hg/ $GOROOT
ubuntuprompt$ mkdir $HOME/go/bin
ubuntuprompt$ cd $GOROOT/src ; ls
ubuntuprompt$ ./all.bash (takes a while to complete.. so go and get a coffee about now)if all goes well you will see..."0 known bugs; 0 unexpected bugs" in your terminal session... -------------------------------------------------------------------------------------------------------------------------------------
Now to test drive GO..
package mainimport "fmt"func main() {
fmt.Printf("Hello World\n")
}
EOF -------------------------------------------------------------------------------------------------------------------------------------
ubuntuprompt$ 8g hello.go -------------------------------------------------------------------------------------------------------------------------------------
ubuntuprompt$ 8l hello.8 -------------------------------------------------------------------------------------------------------------------------------------
ubuntuprompt$ ./8.out
Hello World ! -------------------------------------------------------------------------------------------------------------------------------------
Congratulations !
-------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------